pro test_miedist,N,d0,logSigma,mr,mi,lambda

  angle = [0, !dpi]
  angle = cos(angle)
  if (N_params() eq 0) then begin
    n_lambda=5
    lambda = (findgen(n_lambda)+1)*0.01 + 0.4; um
    Kxt=fltarr(n_lambda)
    Kbk=fltarr(n_lambda)
    Ksc=fltarr(n_lambda)
    Bext=fltarr(n_lambda)
    Bsca=fltarr(n_lambda)
    N = 100
    d0=0.04d
    Sigma=1.5d
    Cm=DComplex(1.33,-0.1)
  endif else Cm=DComplex(mr,mi)
  r = (findgen(1000)+1)*0.001 ; um
  n_r = LogNormal_r(N,d0,r,Sigma)
  plot,r,n_r
  for i =0, n_lambda-1 do begin
    Mie_dist,n_r,r,lambda[i],Cm,Dqv=angle,tmpKxt,tmpKsc,tmpKbk,eta
    Mie_LogNormal,N,d0,logSigma,double(1d/double(lambda[i])),Cm,tmpBext,tmpBsca,w,g
;    Mie_LogNormal,N,d0,Exp(logSigma),lambda[i],Cm,tmpBext,tmpBsca,w,g
    Kxt[i]=tmpKxt
    Kbk[i]=tmpKbk
    Ksc[i]=tmpKsc
    Bext[i]=tmpBext
    Bsca[i]=tmpBsca
    print,'step ',i,': WaveLength=',lambda[i],' micron'
    print,'Kxt=',tmpKxt,'  Bext=',tmpBext
  endfor
  wait,2
  plot,lambda,Kxt,/xlog,/ylog
  oplot,lambda,Kbk
  oplot,lambda,Bext,color='FFCC00'xl
end
